//
// static_assert.h
//
// Compile-time asserts
//
// Based on the one from boost:
// http://www.boost.org/boost/static_assert.hpp
//
// Usage:
//
// kStaticAssert(constant_boolean_expression);
//
// This can appear at file scope or within a block (anyplace a typedef
// is OK).
//
// TODO: deprecate and replace with the static assert in base/basictypes
#ifndef LONGKEY_COMMON_STATIC_ASSERT_H_
#define LONGKEY_COMMON_STATIC_ASSERT_H_

template <bool> struct STATIC_ASSERTION_FAILURE;

template <> struct STATIC_ASSERTION_FAILURE<true> { enum { value = 1 }; };

template<int> struct static_assert_test{};

#define STATIC_ASSERT( B ) \
	typedef static_assert_test<\
	sizeof(STATIC_ASSERTION_FAILURE< (bool)( B ) >)>\
	static_assert_typedef_ ##  __LINE__

#endif  // LONGKEY_COMMON_STATIC_ASSERT_H_